// miniprogram/pages/personalCenter/personalCenter.js
var app = getApp();
const host = app.globalData.host;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    avatarUrl: "",
    nickName: "",
    ownedProjects: [],
    participatedProjects: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.setData({
      avatarUrl: app.globalData.userInfo.avatarUrl,
      nickName: app.globalData.userInfo.nickName,
    });
    /*
    wx.request({
      url: host + 'city360/queryUser',
      data:{
        openid: app.globalData.openid
      },
      method:"POST",
      header:{
        'content-type': 'application/x-www-form-urlencoded'
      },
      complete: res=>{
        console.log(res);
        var ownedProjectsStr = res.data.ownedProjects;
        var participatedProjectsStr = res.data.participatedProjects;
        console.log("origin owned", ownedProjectsStr);
        console.log("origin par", participatedProjectsStr);
        var ownedArray = ownedProjectsStr.split(",");
        var partiArray = participatedProjectsStr.split(",");
        ownedArray.pop();
        partiArray.pop();
        console.log("poped owned", ownedArray);
        console.log("poped par", partiArray);
        that.setData({
          ownedProjects: ownedArray,
          participatedProjects: partiArray,
        });
        console.log("ownedProjects", that.data.ownedProjects);
        console.log("participatedProjects", that.data.participatedProjects);
      }
    })*/
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})